 const get_account = function get_account(){
  var account=JSON.parse(localStorage.getItem("account"));
  return account;
}
 const get_token = function get_token(){
   var token=sessionStorage.getItem("token");
   return token;
 }

 // 返回格式为xx天xx小时xx分钟
 const complete_time =function complete_time(faultDate, completeTime) {
   let stime = Date.parse(new Date(faultDate));
   let etime = Date.parse(new Date(completeTime));
   // 两个时间戳相差的毫秒数
   let usedTime = etime - stime;
   // 计算相差的天数
   let days = Math.floor(usedTime / (24 * 3600 * 1000));
   // 计算天数后剩余的毫秒数
   let leave1 = usedTime % (24 * 3600 * 1000);
   // 计算出小时数
   let hours = Math.floor(leave1 / (3600 * 1000));
   // 计算小时数后剩余的毫秒数
   let leave2 = leave1 % (3600 * 1000);
   // 计算相差分钟数
   let minutes = Math.floor(leave2 / (60 * 1000));

   // 计算分钟数后剩余的秒数
   let leave3 = leave2 % (1000);
   // 计算相差秒数
   let second = Math.floor(leave3 / 1000);
   let time = "";
   if(days){
     time = time+days + "天"
   }
   if(hours){
     time = time+hours + "时"
   }
   time = time+minutes + "分"

   time = time+second + "秒"

   let data ={
     days:days,
     hours:hours,
     minutes:minutes,
     second:second,
     complete_time:usedTime,
     complete_text:time
   };
   return data;
 }
 export { get_account ,get_token ,complete_time}
